package com.xiaohudie.JiChu;

import lombok.SneakyThrows;

import java.io.PrintStream;

/**
 * @Author xiao hu die
 * @Date 2022/1/11 21:56
 * @Version 1.0
 */
public class StaticKuai {
 /**定义一个静态变量*/
 public  static  Integer a =0;
 {
  a++;
  System.out.println("非静态代码块中a为:" +a);
 }
 static {
  a++;
  System.out.println("静态代码块1中a为:" +a);
 }
 static {
  a++;
  System.out.println("静态代码块2中a为:" +a);
 }

 @SneakyThrows
 public static void main(String[] args) {
  System.setOut(new PrintStream("D:\\ld.txt"));
  System.out.println("+++++ 创建对象   +++++");
  StaticKuai staticKuai =new StaticKuai();
  System.out.println("++++++++ 第二次创建对象 ++++++");
  StaticKuai staticKuai1 =  new StaticKuai();
 }
}
